package com.trdcore.zyzkt.config;

import com.trdcore.zyzkt.utils.ConstantPropertiesUtil;
import me.chanjar.weixin.mp.api.WxMpService;
import me.chanjar.weixin.mp.api.impl.WxMpServiceImpl;
import me.chanjar.weixin.mp.config.WxMpConfigStorage;
import me.chanjar.weixin.mp.config.impl.WxMpDefaultConfigImpl;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.stereotype.Component;


@Component
@Configuration
public class WeChatMpConfig {

//    @Value("${wechat.mpAppId}")
//    private String appId;
//
//    @Value("${wechat.mpAppSecret}")
//    private String appSecret;
    @Bean
    public WxMpService wxMpService(){
        WxMpService wxMpService = new WxMpServiceImpl();
        wxMpService.setWxMpConfigStorage(wxMpConfigStorage());
        return wxMpService;
    }
    @Bean
    public WxMpConfigStorage wxMpConfigStorage(){
        WxMpDefaultConfigImpl wxMpConfigStorage = new WxMpDefaultConfigImpl();
        wxMpConfigStorage.setAppId("wx9b94b80296bd13f1");
        wxMpConfigStorage.setSecret("7d823d9a12f8efa5db166ce1d67fd2f4");
        return wxMpConfigStorage;
    }
}